﻿namespace MsForgeReboot.Tests.Integration.ControlPanel.Controllers {
    #region Usings

    using System.Web.Mvc;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using MsForgeReboot.Web.Areas.ControlPanel.Controllers;

    #endregion

    [TestClass]
    public class PostControllerTests {
        #region Public Methods and Operators

        PageController target;
        
        [TestInitialize]
        public void TestInitialization() {
            target = new PageController();
        }

        [TestCleanup]
        public void TestCleanup()
        {
            target = new PageController();
        }

        [TestMethod]
        public void GetUrlFriendlyTitleReplacesSpacesWithHyphens() {
            const string Expected = "this-is-correct-title";
            
            var actual = (JsonResult)target.GetUtlTitle("This is correct title");

            Assert.AreEqual(Expected, actual.Data.ToString());
        }

        [TestMethod]
        public void GetUrlFriendlyTitleReplacesEqualsSpacesWithHyphens()
        {
            const string Expected = "this-is-correct-title";
           
            var actual = (JsonResult)target.GetUtlTitle("This is correct=title");

            Assert.AreEqual(Expected, actual.Data.ToString());
        }

        [TestMethod]
        public void GetUrlFriendlyTitleReplacesAmpersandWithAndWord()
        {
            const string Expected = "this-is-correct-title-and-test";
           
            var actual = (JsonResult)target.GetUtlTitle("This is correct title & test");

            Assert.AreEqual(Expected, actual.Data.ToString());
        }

        #endregion
    }
}